package cc.uncarbon.module.appapi.web.app;

import cc.uncarbon.framework.web.model.response.ApiResult;
import cc.uncarbon.module.appapi.constant.AppApiConstant;
import cc.uncarbon.module.appapi.model.request.AppointMentDTO;
import cc.uncarbon.module.appapi.model.vo.AppointmentVO;
import cc.uncarbon.module.appapi.service.AppointmentService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Tag(name = "小程序预约")
@RequestMapping(AppApiConstant.HTTP_API_URL_PREFIX + "/api/v1")
@RequiredArgsConstructor
@RestController
@Slf4j
public class AppointmentController {
    private final AppointmentService appointmentService;
    @Operation(summary = "查询预约时间")
    @GetMapping("/appointment/{staffId}")
    public ApiResult<List<AppointmentVO>> getDateList(@PathVariable Long staffId) {
        return ApiResult.data(appointmentService.getDataList(staffId));
    }
    @Operation(summary = "预约")
    @PostMapping("/appointment/order")
    public ApiResult<Void> insert(@RequestBody @Valid AppointMentDTO dto) {
        appointmentService.insert(dto);
        return ApiResult.success("预约成功");
    }
}
